package com.zanglikun.activity.util;

/**
 * @author : zanglikun
 * @date : 2025/10/31 14:31
 * @desc : Copyright © zanglikun.com
 */
public class CalculatePriceActivity  implements Activity {
    @Override
    public boolean execute(ActivityContext context) {
        System.out.println("【计算价格】开始计算订单总价...");
        int quantity = (Integer) context.get("quantity");
        double unitPrice = (Double) context.get("unitPrice");

        double totalPrice = quantity * unitPrice;
        context.put("totalPrice", totalPrice);

        System.out.println("【计算价格】✓ 总价: " + totalPrice);
        return true;
    }

    @Override
    public String getName() {
        return "CalculatePriceActivity";
    }
}